#ifndef LOGINWINDOW_H
#define LOGINWINDOW_H

#include <QMainWindow>
#include <QDebug>
#include <QSettings>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QMessageBox>
#include <QJsonDocument>
#include <QJsonObject>
#include "./plugIn/qaesencryption.h"
#include "bluetoothwideget.h"
#include "./plugIn/loadingdialog.h"
#include "mythread.h"
#include "runthread.h"



QT_BEGIN_NAMESPACE
namespace Ui { class LoginWindow; }
QT_END_NAMESPACE

class LoginWindow : public QMainWindow
{
    Q_OBJECT

public:
    LoginWindow(QWidget *parent = nullptr);
    ~LoginWindow();

private:
    Ui::LoginWindow *ui;
    BluetoothWideget *bluetoothWideget;
    LoadingDialog *loadingDialog;

    QString account;
    QString password;

    /*对账户密码进行编码解码*/
    QString aesIv = "encryptionIntVec";
    QString aesKey = "DJFKPORK586DBC35";
    QString encodeInfo(QString code);
    QString decodeInfo(QString encode);

    /*HTTP*/
    const QString loginApi = "/scanning/security/login";
    const QString baseUrl = "http://localhost:8880";
    //    const QString baseUrl = "http://121.36.217.102:8880";

    QNetworkReply *reply;
    QString token;

    QThread *loadingChildThread;
    MyThread *targetThread;



    void initAllInformation();

private slots:
    void login();               //登录
    void home();                //home
    void contacts();            //联系
    void aboutUs();             //关于我们
    void loginResult();         //登录结果
    void on_close_clicked();    //关闭
    void slotError(QNetworkReply::NetworkError); //登录错误

signals:

};
#endif // LOGINWINDOW_H
